#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>

using namespace std;

const int maxn=10005;
const double eps=1e-7;

inline int dcmp(const double &d){if(fabs(d)<eps) return 0;return d>0?1:-1;}
inline double ab(const double &d){if(dcmp(d)<0) return -d; return d;}
struct Point{
    double x,y;
    Point(double x=0,double y=0):x(x),y(y){}
    const Point operator - (const Point &p) const{return Point(x-p.x,y-p.y);}
    const double operator * (const Point &p) const{return x*p.x+y*p.y;}
};
inline double cross(const Point &p,const Point &q){return p.x*q.y-p.y*q.x;}
inline double dis(const Point &p){return sqrt(p.x*p.x+p.y*p.y);}
inline double dseg(const Point &p,const Point &u,const Point &v){
    if(dcmp((p-u)*(v-u))>=0&&dcmp((v-p)*(v-u))>=0) return ab(cross(v-u,p-u)/dis(v-u));
    else return min(ab(dis(p-u)),ab(dis(p-v)));
}

Point a[maxn],b[maxn];
int n,m;
inline double area(const Point &a,const Point &b,const Point &c){
    return ab(cross(c-a,b-a));
}
double RC(){
    double ans=dis(a[0]-b[0]);
    //printf("ans=%.4f\n",ans);
    int q=0;
    a[n]=a[0];b[m]=b[0];
    for(int i=0;i<n;i++){
        while(dcmp(area(a[i],a[i+1],b[q+1])-area(a[i],a[i+1],b[q]))<0) q++,q%=m;
        ans=min(ans,min(dis(a[i]-b[q]),min(dseg(b[q],a[i],a[i+1]),dseg(b[q+1],a[i],a[i+1]))));
        //if(i==1) printf("(%.4f,%.4f)-(%.4f,%.4f) (%.4f,%.4f) dis=%.4f dseg=%.4f\n",a[i].x,a[i].y,a[i+1].x,a[i+1].y,b[q].x,b[q].y,dis(a[i]-b[q]),dseg(b[q],a[i],a[i+1]));
    }
    return ans;
}

int main(){
    while(~scanf("%d%d",&n,&m)){
        double ans;
        if(n==0&&m==0) break;
        for(int i=0;i<n;i++) scanf("%lf%lf",&a[i].x,&a[i].y);
        for(int i=0;i<m;i++) scanf("%lf%lf",&b[i].x,&b[i].y);
        ans=RC();
        for(int i=0;i<m/2;i++) swap(b[i],b[m-i-1]);
        ans=min(ans,RC());
        printf("%.5f\n",ans+eps);
    }
}
